<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text"
                   value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Game_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-game_id" data-rule="required" data-source="game/lists/index"
                   class="form-control selectpage"
                   name="row[game_id]" type="text" value="{$row.game_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">分成比例:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-divide_ratio" data-rule="required,digits,range[~100]" class="form-control"
                   name="row[divide_ratio]"
                   type="number" value="{$row.divide_ratio|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">模式说明:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc" data-rule="required" class="form-control" name="row[desc]" type="text"
                   value="{$row.desc|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2 ">模式人数:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-capacity_num" data-rule="required,digits" class="form-control"
                   name="row[capacity_num]"
                   type="number" value="{$row.capacity_num|htmlentities}">
        </div>
    </div>
    <!--    <div class="form-group">-->
    <!--        <label class="control-label col-xs-12 col-sm-2"></label>-->
    <!--        <div class="col-xs-12 col-sm-8">-->
    <!--            <p style="color: red">模式人数和比例是对应的，人数为5人是，下列比例只拿5列。比例总数不超过100...</p>-->
    <!--        </div>-->
    <!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-xs-offset-1" style="text-align: left">结算分成比例:</label>
        <div class="col-xs-12 col-sm-10 col-xs-offset-1">
            <table class="table fieldlist" data-template="basictpl" data-name="row[spec]"
                   id="first-table">
                <tr>
                    <td>√</td>
                    {php}$mingci=$row['capacity_num'];{/php}
                    {for start="0" end="$row['capacity_num']"}
                    <td>{$mingci}人</td>
                    {php} $mingci--; {/php}
                    {/for}
                </tr>
            </table>

            <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
            <textarea name="row[spec]" class="form-control hide"
                      data-required="true">{:json_encode($row.specs,true)}</textarea>
            <script id="basictpl" type="text/html">
                <tr class="form-inline">
                    <td>第<%=index+1%>名</td>
                    {for start="0" end="$row['capacity_num']"}
                    <td>
                        <input type="hidden" name="<%=name%>[<%=index%>][id_{$i}]" value="<%=row.id_{$i}%>">
                        <input type="hidden" name="<%=name%>[<%=index%>][rank_num_{$i}]" value="<%=row.rank_num_{$i}%>">
                        <input type="hidden" name="<%=name%>[<%=index%>][num_{$i}]" value="<%=row.num_{$i}%>">
                        <input type="number" name="<%=name%>[<%=index%>][ratio_{$i}]" class="form-control"
                               value="<%=row.ratio_{$i}%>" data-rule="range[~100]" placeholder="比例"
                               style="width: 80px"/>
                    </td>
                    {/for}
                </tr>
            </script>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
